The present invention relates to a flash memory device.
A flash memory device manages a memory region in blocks to shorten the time for reading data (refer to, for example, Japanese Laid-Open Patent Publication No. 9-134312). A block management value is added to each block. The block management value is information indicating whether the corresponding block is in a used state (active state) or unused state.
As shown in FIG. 4, a block management value is formed by a four-digit number of the hexadecimal system. More specifically, “$1111” is allocated as the block management value in an active state, and “$FFFF” is allocated as the block management value in a non-used state. In the description hereafter, a number following “$” is a hexadecimal number.
A flash memory device will now be described with reference to the upper part of FIG. 4, which shows a first block in an active state and a second block in an unused state. The two blocks each include first to nth data areas A1 to An, which store data. The data areas A1 to An in the unused second block are all empty and do not include data. When there is a write request for data (updated value), updated values are sequentially written to the first to nth data areas A1 to An of the first block. This reduces the empty data areas. Then, as shown in the lower part of FIG. 4, when an updated value is written to the data area An of the first block, the block management value of the second block is rewritten from “$FFFF”, which indicates an unused state, to “$1111”, which indicates an active state, and the updated value is copied to the first data area A1 of the second block. Subsequently, the data stored in the first block is completely erased, and the block management value is rewritten from “$1111”, which indicates the active state to “$FFFF”, which indicates the unused state.
When an updated value is copied, the updated value may be renewed. In this case, the renewed updated value is written to the first data area A1 of the second block.
When an updated value is copied from the first block to the second block, the flash memory device may be reset when its power supply is temporarily deactivated. In this case, the first block is not switched to an unused state. Thus, when the power supply is activated again during the resetting, two blocks would be in an activate state, and the updated value becomes unknown.
In particular, during the copying of an updated value, renewal of the updated value would result in the updated values of the first and second blocks being different data. In this case, the true updated value is that of the second block. However, there is no means to recognize the true updated value. This may result in erroneously reading of the updated value of the first block.
It is an object of the present invention to provide a flash memory device that recognizes the true updated value.